import useSWR from 'swr';
import { getGlobeDataApi } from '@/app/cg06/api/supplyChainNetwork';
import { useAuthStore } from '@/app/cg06/store/useAuthStore';

export const useGlobeData = () => {
	const token = useAuthStore(s => s.token);
	const { data, error, isLoading } = useSWR(
    () => (token ? "/big-screen/api/v2/businessIndicator/preview" : null),
    getGlobeDataApi,
    { revalidateOnFocus: false }
	);
	return {
		data: data,
		isLoading,
		isError: error
	};
};

